
package poker.plans.croupier;

import jadex.adapter.fipa.AgentIdentifier;
import jadex.adapter.fipa.SFipa;
import jadex.runtime.IMessageEvent;
import jadex.runtime.Plan;

import poker.beliefs.GameResult;

/**
 *  Plan to notify a loser player about the result of the game
 */

public class NotifyGameResultPlan extends Plan {

	public void body() {
		System.out.println("CROUPIER " + getAgentName() + ": Notify game result");
		
		AgentIdentifier loser = (AgentIdentifier)getParameter("loser").getValue();
		GameResult result = (GameResult)getParameter("game_result").getValue();

		IMessageEvent msg = createMessageEvent("youLose");
		msg.getParameterSet(SFipa.RECEIVERS).addValue(loser);
		msg.setContent(result);
		sendMessage(msg);
	}
	
}
